package com.zrrd.learn.chapter03;

/**
 * 快乐数
 * @author asus
 * @version 1.0
 * @date 2023/5/13 15:49
 */
public class HappyNum {
    int a =19;
    public static boolean isHappy(int a){
        int n = 0;
        while(a!=1){
            int f = a%10;
            int s = a/10%10;
            int t = a/100%10;
            a=f*f+s*s+t*t;
            n++;
            if(n>=100){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(isHappy(648));
    }
}
